package com.lzd.main.controller;

import com.lzd.main.bdmap.BaiduMapWebApi;
import com.lzd.main.dao.AntiFakeDao;
import jakarta.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@CrossOrigin(origins = "*")
@RestController
public class BdMapController {

    private static final Logger logger = LoggerFactory.getLogger(BdMapController.class);

    @Value("${server.hosturl}")
    private String hostUrl;

    @Autowired
    private AntiFakeDao antiDao;


    /**
     * 获得百度路线
     * @return
     * @throws SQLException
     */
    @RequestMapping("/bdmap/route")
    public Map<String,Object> codeBindProd(HttpServletResponse response) throws SQLException, IOException, NoSuchAlgorithmException {

        List<Double[]> list = BaiduMapWebApi.routePointArr("39.54336666,116.69058173", "39.751019088752415,117.00018499999993");

        Map<String,Object> map = new HashMap<>();
        map.put("data",list);
        return map;
    }
}